package symbol;

import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Set;

import error.ErrorMsg;

public class FieldTable extends Table {
        
        private Hashtable<Symbol, Object> bindings;
        
        public FieldTable() {
                bindings = new Hashtable<Symbol, Object>();
        }

        @Override
        public Object get(Symbol key) {
                return bindings.get(key);
        }

        @Override
        public Set<Symbol> keys() {
                return bindings.keySet();
        }

        @Override
        public void put(Symbol key, Object value) {
                if(bindings.get(key)==null) bindings.put(key, value);
        }
        
        public void print() {
        		if(keys() != null && keys().size() > 0)
        		{
        				for (Symbol k : keys()) {
        					System.out.println(k+" "+get(k));
        				}
        		}
        }
}
